<template>
  <div class="wrapper" ref="wrapper">
    <slot></slot>
  </div>
</template>

<script>
import Bscroll ,{observeDom} from  'better-scroll'
export default {
    name:'Scroller',
    props: {
        handleToScroll : {
            type : Function,
            default : function() {}
        },
        handleToTouchEnd : {
            type : Function,
            default : function() {}
        }
    },
    mounted () {
        var scroll = new Bscroll(this.$refs.wrapper,{ observeDOM:true, probeType: 1,click:true,tap:true})
        scroll.on('scroll',(pos) => {
            this.handleToScroll(pos);
        })
        scroll.on('touchEnd' ,(pos) => {
            this.handleToTouchEnd (pos);
            // this.pullDownMsg = "更新完成"
            // setTimeout(()=>{
            // this.pullDownMsg = ''
            // },100)
        })
    },
    methods: {
        toScrollTop () {

        }
    }
}
</script>

<style scoped>
.wrapper{
    height: 100%;
}
</style>